package com.sina.weibo;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnMultiChoiceClickListener;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.res.Resources;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;

public class SettingsPref extends PreferenceActivity
  implements Preference.OnPreferenceClickListener, DialogInterface.OnClickListener, DialogInterface.OnMultiChoiceClickListener
{
  private static final int DIALOG_ALERT_CATEGORY_REMIND = 1002;
  private static final int DIALOG_ALERT_CLEAR_CACHE = 1000;
  private static final int DIALOG_PROGRESS_DOING = 1001;
  public static final String KEY_AUDIO = "audio";
  public static final String KEY_AUTOLOADMORE = "autoload_more";
  public static final String KEY_DOWNLOAD_IMAGE_SIZE = "download_image_size";
  public static final String KEY_FAST_SCROOL_BAR = "fast_scroll_bar";
  public static final String KEY_INTERVAL = "interval";
  public static final String KEY_NOTIFYAT = "notify_at";
  public static final String KEY_NOTIFYCOMMENT = "notify_comment";
  public static final String KEY_NOTIFYFANS = "notify_fans";
  public static final String KEY_NOTIFYMESSAGE = "notify_message";
  public static final String KEY_NOTIFYNEWBLOG = "notify_newblog";
  public static final String KEY_PICTURE_SIZE = "picture_size";
  public static final String KEY_REMIND = "auto_remind";
  public static final String KEY_SCREEN_ORIENTATION = "screenorientation";
  public static final String KEY_SHOWPICTURE = "show_picture";
  public static final String KEY_UPLOAD_IMAGE_SIZE = "upload_image_size";
  public static final String KEY_VIBRATOR = "vibrator";
  private static SharedPreferences defaultpreference;
  private AlertDialog categoryRemingDialog;
  private AlertDialog clearCacheDialog;

  static int getDefaultImageDownloadSize(Context paramContext)
  {
    return 240;
  }

  static SharedPreferences getDefaultSharedPreference(Context paramContext)
  {
    if (defaultpreference == null)
      defaultpreference = PreferenceManager.getDefaultSharedPreferences(paramContext);
    return defaultpreference;
  }

  static String getDownloadImageSize(Context paramContext)
  {
    SharedPreferences localSharedPreferences = getDefaultSharedPreference(paramContext);
    String str = paramContext.getString(2131427632);
    return localSharedPreferences.getString("download_image_size", str);
  }

  static String[] getDownloadImageSizeSet(Context paramContext)
  {
    return paramContext.getResources().getStringArray(2131165191);
  }

  static int getInterval(Context paramContext)
  {
    return Integer.parseInt(getDefaultSharedPreference(paramContext).getString("interval", "180000"));
  }

  static String getUploadImageSize(Context paramContext)
  {
    return getDefaultSharedPreference(paramContext).getString("upload_image_size", "TwoMP");
  }

  static String[] getUploadImageSizeSet(Context paramContext)
  {
    return paramContext.getResources().getStringArray(2131165189);
  }

  static boolean isAudioOn(Context paramContext)
  {
    return getDefaultSharedPreference(paramContext).getBoolean("audio", 1);
  }

  static boolean isAutoLoadMore(Context paramContext)
  {
    return getDefaultSharedPreference(paramContext).getBoolean("autoload_more", 0);
  }

  static boolean isAutoRemind(Context paramContext)
  {
    return getDefaultSharedPreference(paramContext).getBoolean("auto_remind", 1);
  }

  private boolean isCancelAllCategorySetting()
  {
    SharedPreferences localSharedPreferences = getDefaultSharedPreference(this);
    if ((localSharedPreferences.getBoolean("notify_newblog", 0)) || (localSharedPreferences.getBoolean("notify_at", 1)) || (localSharedPreferences.getBoolean("notify_comment", 1)) || (localSharedPreferences.getBoolean("notify_message", 1)) || (localSharedPreferences.getBoolean("notify_fans", 1)));
    for (int i = 0; ; i = 1)
      return i;
  }

  static boolean isFastScrollOn(Context paramContext)
  {
    return getDefaultSharedPreference(paramContext).getBoolean("fast_scroll_bar", 1);
  }

  static boolean isNotifyAt(Context paramContext)
  {
    return getDefaultSharedPreference(paramContext).getBoolean("notify_at", 0);
  }

  static boolean isNotifyComment(Context paramContext)
  {
    return getDefaultSharedPreference(paramContext).getBoolean("notify_comment", 0);
  }

  static boolean isNotifyFans(Context paramContext)
  {
    return getDefaultSharedPreference(paramContext).getBoolean("notify_fans", 0);
  }

  static boolean isNotifyMessage(Context paramContext)
  {
    return getDefaultSharedPreference(paramContext).getBoolean("notify_message", 0);
  }

  static boolean isNotifyNewWeibo(Context paramContext)
  {
    return getDefaultSharedPreference(paramContext).getBoolean("notify_newblog", 0);
  }

  static boolean isPicShowing(Context paramContext)
  {
    return getDefaultSharedPreference(paramContext).getBoolean("show_picture", 1);
  }

  static boolean isScreenPortrait(Context paramContext)
  {
    return getDefaultSharedPreference(paramContext).getBoolean("screenorientation", 1);
  }

  static boolean isVibratorOn(Context paramContext)
  {
    return getDefaultSharedPreference(paramContext).getBoolean("vibrator", 1);
  }

  private boolean[] readCategorySetting()
  {
    SharedPreferences localSharedPreferences = getDefaultSharedPreference(this);
    boolean[] arrayOfBoolean = new boolean[5];
    boolean bool1 = localSharedPreferences.getBoolean("notify_newblog", 0);
    arrayOfBoolean[0] = bool1;
    boolean bool2 = localSharedPreferences.getBoolean("notify_at", 1);
    arrayOfBoolean[1] = bool2;
    boolean bool3 = localSharedPreferences.getBoolean("notify_comment", 1);
    arrayOfBoolean[2] = bool3;
    boolean bool4 = localSharedPreferences.getBoolean("notify_message", 1);
    arrayOfBoolean[3] = bool4;
    boolean bool5 = localSharedPreferences.getBoolean("notify_fans", 1);
    arrayOfBoolean[4] = bool5;
    return arrayOfBoolean;
  }

  public void onClick(DialogInterface paramDialogInterface, int paramInt)
  {
    AlertDialog localAlertDialog = this.clearCacheDialog;
    if ((paramDialogInterface == localAlertDialog) && (paramInt == -1))
    {
      SettingsPref.1 local1 = new SettingsPref.1(this);
      Void[] arrayOfVoid = new Void[0];
      AsyncTask localAsyncTask = local1.execute(arrayOfVoid);
    }
  }

  public void onClick(DialogInterface paramDialogInterface, int paramInt, boolean paramBoolean)
  {
    AlertDialog localAlertDialog = this.categoryRemingDialog;
    SharedPreferences.Editor localEditor1;
    if (paramDialogInterface == localAlertDialog)
    {
      localEditor1 = getDefaultSharedPreference(this).edit();
      switch (paramInt)
      {
      default:
      case 0:
      case 1:
      case 2:
      case 3:
      case 4:
      }
    }
    while (true)
    {
      boolean bool = localEditor1.commit();
      if (isCancelAllCategorySetting())
      {
        Intent localIntent = new Intent("sina.weibo.action.SETTING");
        sendBroadcast(localIntent);
      }
      return;
      SharedPreferences.Editor localEditor2 = localEditor1.putBoolean("notify_newblog", paramBoolean);
      continue;
      SharedPreferences.Editor localEditor3 = localEditor1.putBoolean("notify_at", paramBoolean);
      continue;
      SharedPreferences.Editor localEditor4 = localEditor1.putBoolean("notify_comment", paramBoolean);
      continue;
      SharedPreferences.Editor localEditor5 = localEditor1.putBoolean("notify_message", paramBoolean);
      continue;
      SharedPreferences.Editor localEditor6 = localEditor1.putBoolean("notify_fans", paramBoolean);
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    addPreferencesFromResource(2131034113);
    PreferenceScreen localPreferenceScreen = getPreferenceScreen();
    localPreferenceScreen.findPreference("remind_category").setOnPreferenceClickListener(this);
    localPreferenceScreen.findPreference("clear_cache").setOnPreferenceClickListener(this);
  }

  protected Dialog onCreateDialog(int paramInt)
  {
    Object localObject = null;
    switch (paramInt)
    {
    default:
    case 1000:
    case 1001:
    case 1002:
    }
    while (true)
    {
      return localObject;
      localObject = new AlertDialog.Builder(this).setTitle(2131427498).setMessage(2131427499).setPositiveButton(2131427441, this).setNegativeButton(2131427436, null).create();
      this.clearCacheDialog = ((AlertDialog)localObject);
      continue;
      localObject = new ProgressDialog(this);
      ProgressDialog localProgressDialog = (ProgressDialog)localObject;
      String str = getString(2131427500);
      localProgressDialog.setMessage(str);
      continue;
      AlertDialog.Builder localBuilder = new AlertDialog.Builder(this).setTitle(2131427571);
      String[] arrayOfString = getResources().getStringArray(2131165198);
      boolean[] arrayOfBoolean = readCategorySetting();
      localObject = localBuilder.setMultiChoiceItems(arrayOfString, arrayOfBoolean, this).setNegativeButton(2131427437, null).create();
      this.categoryRemingDialog = ((AlertDialog)localObject);
    }
  }

  public boolean onPreferenceClick(Preference paramPreference)
  {
    if (paramPreference.getKey().equals("remind_category"))
      showDialog(1002);
    while (true)
    {
      return false;
      if (!paramPreference.getKey().equals("clear_cache"))
        continue;
      showDialog(1000);
    }
  }
}

/* Location:           D:\Program Files\eclipse\apktool-r01-3\新浪微博\classes.dex.dex2jar.jar
 * Qualified Name:     com.sina.weibo.SettingsPref
 * JD-Core Version:    0.6.0
 */